<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
	layout:decorator="layout/default">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>系统角色列表</title>
</head>
<body>
	<div layout:fragment="content">
		<div class="row" style="margin-bottom: 12px;">
			<div class="row" style="margin-bottom: 12px;">
				<div th:replace="fragments/searchBox::topSearch"></div>
				<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
					<shiro:hasPermission name="authRole:new">
						<a type="button" class="btn btn-sm btn-success pull-right"
							title="创建新角色" th:href="@{/roles/new}">创建新角色</a>
					</shiro:hasPermission>
				</div>
			</div>

			<div class="row">
				<div class="col-lg-12 col-md-12 col-sm-12 xol-xs-12">
					<div th:unless="${#lists.isEmpty(page.list)}"
						th:replace="auth/role/index::showRoles(${page.list}, true)"></div>
					<div
						th:replace="fragments/pagination::pagination(${'/roles'}, ${page})"></div>
				</div>
			</div>
		</div>
	</div>

	<div class="table-responsive"
		th:fragment="showRoles(roleList, editable)">
		<table class="table table-striped table-hover table-condensed">
			<thead>
				<tr>
					<th>角色名称</th>
					<th>角色可用</th>
					<th>创建时间</th>
					<th>更新时间</th>
					<th th:if="${editable}"></th>
				</tr>
			</thead>
			<tbody>
				<tr data-th-each="role: ${roleList}" data-th-object="${role}">
					<td><a data-th-href="@{'/roles/' + *{roleId}}"
						data-th-text="*{roleName}"></a></td>
					<td data-th-text="*{available}"></td>
					<td><span th:if="*{createdTime}"
						th:text="*{#dates.format(createdTime, 'yyyy-MM-dd HH:mm:ss')}"></span></td>
					<td><span th:if="*{updateTime}"
						th:text="*{#dates.format(updateTime, 'yyyy-MM-dd HH:mm:ss')}"></span></td>
					<td th:if="${editable}">
						<div class="btn-toolbar pull-right hidden-print">
							<div class="btn-group btn-group-xs">
								<shiro:hasPermission name="authRole:edit">
									<a class="btn btn-default" title="修改角色"
										th:href="@{/roles/{id}/edit(id=*{roleId})}">编辑</a>
								</shiro:hasPermission>
								<shiro:hasPermission name="authRole:delete">
									<a class="btn btn-danger" title="删除该角色"
										onclick="if(confirm('确定删除?')==false)return false;"
										th:href="@{/roles/{id}/del(id=*{roleId})}">删除</a>
								</shiro:hasPermission>
							</div>
						</div>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</body>
</html>
